package com.cloud.jdkTest;

import com.cloud.bean.SerialBean;


import java.io.*;

public class SerialTest {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        FileOutputStream fos = new FileOutputStream("SerialBean.clazz");
        SerialBean bean = new SerialBean("12", "shuchuanbiao");
        bean.setPassWord("666666");
        ObjectOutputStream oos = new ObjectOutputStream(fos);
        oos.writeObject(bean);
        oos.flush();
        oos.close();
        FileInputStream fis = new FileInputStream("SerialBean.clazz");
        ObjectInputStream ois = new ObjectInputStream(fis);
        SerialBean myBean = (SerialBean) ois.readObject();
        ois.close();
        System.out.println(myBean);
    }
}
